package cn.tedu.thread;

public class PriorityDemo {
    public static void main(String[] args) {
        Thread max = new Thread(){
            public void run(){
                for (int i=0;i<10000;i++){
                    System.out.println("调整线程优先级可以最大程度上改善一个线程获取时间片的机率");
                }
            }
        };
        Thread min = new Thread(){
            public void run(){
                for (int i=0;i<10000;i++){
                    System.out.println("最小优先级的线程");
                }
            }
        };
        Thread norm = new Thread(){
            public void run(){
                for (int i=0;i<10000;i++){
                    System.out.println("线程有10个优先级,10为最高,5为默认,1为最低");
                }
            }
        };
        min.setPriority(Thread.MIN_PRIORITY);
        max.setPriority(Thread.MAX_PRIORITY);
        min.start();
        max.start();
        norm.start();
    }
}
